//
//  PSReenvioSenhaViewController.m
//  psique
//
//  Created by Saulo Prado on 02/08/13.
//  Copyright (c) 2013 Saulo Prado. All rights reserved.
//

#import "PSReenvioSenhaViewController.h"

@interface PSReenvioSenhaViewController ()

@end

@implementation PSReenvioSenhaViewController

@synthesize txtemail;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)ReenviarSenha:(id)sender {
   
    MFMailComposeViewController * mailController = [[MFMailComposeViewController alloc] init];
    
    mailController.mailComposeDelegate = self;

    [mailController setSubject:@"Psique: Solicitacao de senha"];
    
    [mailController setSubject:@"Psique: Solicitacao de senha"];
    [mailController setMessageBody:@"testando" isHTML:YES];
    [self presentModalViewController:mailController animated:YES];
    
    
    //[mailController release];
    
}

- (BOOL) validarEmail:(NSString *) candidate
{
    NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Aa-z0-9.-]+\\.[A-Za-z]{2,4}";
    NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
    
    return [emailTest evaluateWithObject:candidate];
}

- (IBAction)recuarTeclado:(id)sender{
    [sender resignFirstResponder];
    
}

- (IBAction)clicarNoFundo:(id)sender{
    [txtemail resignFirstResponder];
}

- (IBAction)limparEmail:(id)sender {
    txtemail.text=@"";
}

@end
